package cn.wolfcode.service.impl;

import cn.wolfcode.service.IArticlesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;

@Service
public class ArticlesServiceImpl implements IArticlesService {

    @Autowired
    private StringRedisTemplate template;

    @Override
    public Integer incr(Long id) {

        //key:
        String key = "article_num:"+id;
        //value:
        Long num = template.boundValueOps(key).increment(1);

        return num.intValue();
    }
}
